<?php

class JElementTags extends JElement
{
	/**
	* Element name
	*
	* @access	protected
	* @var		string
	*/
	var $_name = 'Tags';

	function __construct( $parent = null )
	{
		parent::__construct( $parent );
		JFactory::getDocument()->addScript( JURI::root( true ). '/administrator/components/com_jloja/elements/tags/tags.js' );
	}
	function fetchElement($name, $value, &$node, $control_name)
	{
		$tags = $this->_getTags();
		include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR .  'tags' . DIRECTORY_SEPARATOR . 'tmpl.php';
	}

	function fetchTooltip($label, $description, &$xmlElement, $control_name='', $name='')
	{
		return;
	}


	private function _getTags()
	{
		$tagModel = new Tag();
		return $tagModel->getTable()->findAll();
	}
}
